<%@page contentType="text/html;charset=utf-8" language="java"%>
<%@page import="com.ai.dmc.index.common.cache.AreaCache"%>
<%@page import="com.ai.dmc.index.common.cache.DataTimeCache"%>
<%@page import="com.ai.dmc.index.common.cache.UserRightCache"%>
<%@page import="net.sf.json.JSONArray"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<%@page import="com.ai.dmc.index.common.cache.HotMapCache"%>
<%@page import="net.sf.json.JSONObject"%>
<%@page import="com.ai.dmc.index.web.util.SessionInfoUtil"%>
<%@page import="com.ai.dmc.index.common.bean.StaffSessBean"%>

<%
	// 系统占用内存
	Runtime r = Runtime.getRuntime();
	long tm = r.totalMemory();
	long fm = r.freeMemory();
	long mm = r.maxMemory();
	String stm  = tm / 1024 / 1024 + "M";
	String sfm  = fm / 1024 / 1024 + "M";
	String smm  = mm / 1024 / 1024 + "M";
	String sum = (tm - fm) / 1024 / 1024 + "M";
%>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>系统缓存</title>
<%@include file="common.jsp"%>
<script type="text/javascript">
	requires([]);
</script>

<style type="text/css">
.nav{position: fixed; top:30px; left: 30px; padding: 40px 40px; background: #f8f8f8;}
.nav li{line-height: 30px; cursor: pointer;}
.nav p{font-weight: bold; color: #32b5cb;}
.wapper{width:800px; margin: 0 auto;}
h2{text-align: center; padding: 20px 0;}
.table{}
.table div{background: #32b5cb; color: #fff; line-height: 30px; padding: 5px; font-weight: bold;}
.table p{padding: 5px; line-height: 22px; border: 1px solid #32b5cb; word-break: break-all;}
</style>
</head>

<body>
<ul class="nav">
	<p>目录导航</p>
	<li>系统占用内存</li>
	<li>权限缓存</li>
	<li>热力图缓存</li>
	<li>dim_data_time缓存</li>
	<li>area缓存</li>
	<li><a href="../../zhly/index.jsp" class="backUrl">返回首页</a></li>
</ul>

<div class="wapper">
	<h2>系统缓存</h2>
	<ul class="table">
		<li>
			<div>系统占用内存</div>
			<p>占用内存大小：<%=sum%></p>
			<p>未使用内存大小：<%=sfm%></p>
			<p>当前占用内存大小：<%=stm%></p>
			<p>系统分配最大内存：<%=smm%></p>
		</li>
		<li>
			<div>权限缓存</div>
			<p>缓存时间：<%=UserRightCache.userRightCache.get(UserRightCache.CACHE_TIME)%></p>
			<p>缓存大小：<%=UserRightCache.getCacheSize()%></p>
			<p>缓存详细：<%=UserRightCache.getCacheStr()%></p>
		</li>
		<li>
			<div>热力图缓存</div>
			<p>实时缓存时间：<%=HotMapCache.hotMapCache.get(HotMapCache.CACHE_NOW_TIME)%></p>
			<p>历史缓存时间：<%=HotMapCache.hotMapCache.get(HotMapCache.CACHE_HISTORY_TIME)%></p>
			<p>缓存大小：<%=HotMapCache.getCacheSize()%></p>
			<p>实时热力图数据：<br/>　　<%=HotMapCache.getCacheNowInfo()%></p>
			<p>回放热力图数据：<br/>　　<%=HotMapCache.getCacheH24Info()%></p>
			<p>对比热力图数据：<br/>　　<%=HotMapCache.getCacheH48Info()%></p>
		</li>
		<li>
			<div>dim_data_time缓存</div>
			<p>缓存时间：<%=DataTimeCache.dataTimeCache.get(DataTimeCache.CACHE_TIME)%></p>
			<p>缓存大小：<%=DataTimeCache.getCacheSize()%></p>
			<p>缓存明细：<%=DataTimeCache.getCacheStr()%></p>
		</li>
		<li>
			<div>area缓存</div>
			<p>缓存时间：<%=AreaCache.cacheTime%></p>
			<p>缓存大小：<%=AreaCache.getCacheSize()%></p>
			<p>缓存明细：<%=AreaCache.getCacheStr()%></p>
		</li>
	</ul>
</div>
</body>
</html>

<script>
$(function(){
	$("p").each(function(){
		var _o = $(this),
		     s = _o.html();

		s = s.replace(/\{/g, "<br/>{");
		s = s.replace(/\},/g, "},<br/><br/>");
		s = s.replace(/\,/g, ",　");


		_o.html(s);
	});

	// 导航点击
	$(".nav li").click(function(){
		var _o = $(this);
		var txt = _o.html();

		$(".table div").each(function(){
			var _oo = $(this);
			var t = _oo.html();

			if(txt == t){
				var h = _oo.position().top;
				$("html,body").animate({
					"scrollTop" : h
				}, 500);
			}
		});
	});
});

</script>

